package hot100;


import comment.TreeNode;

/**
 * @Author: wzp
 * @CreateTime: 2024-09-12  11:27
 * @Description: 二叉树的最大深度
 * @Version: 1.0
 */
public class hot_104 {
    public static int min=Integer.MIN_VALUE;
    public int maxDepth(TreeNode root) {
        min=Integer.MIN_VALUE;
        if(root==null){
            return 0;
        }
        maxHight(root,0);
        return min;
    }
    public void maxHight(TreeNode root,int h){
        if(root==null){
            min=h>min?h:min;
            return;
        }
        maxHight(root.left,h+1);
        maxHight(root.right,h+1);

    }


}
